﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Butterfly.Library.Utilities;
using Butterfly.User.Library.Providers;
using Butterfly.Library.Components.Users;
using Butterfly.Library;

namespace Butterfly.User.Library.Components.ib_User
{
    public class ib_UserController
    {
        public static List<ib_UserInfo> GetAll()
        {
            return ObjectHelper.FillCollection<ib_UserInfo>(DataProvider.Instance(Definition.NameSqlProvider).User_GetAll());
        }

        public static ib_UserInfo GetInfoByUsername(string _username)
        {
            return ObjectHelper.FillObject<ib_UserInfo>(DataProvider.Instance(Definition.NameSqlProvider).User_GetInfoByUsername(_username));
        }

        public static ib_UserInfo GetInfoByUserId(int _userId)
        {
            return ObjectHelper.FillObject<ib_UserInfo>(DataProvider.Instance(Definition.NameSqlProvider).User_GetInfoByUserId(_userId));
        }

        public static void Insert(ib_UserInfo _objUser)
        {
            DataProvider.Instance(Definition.NameSqlProvider).User_Insert(_objUser);
        }

        public static void Update(ib_UserInfo _objUser)
        {
            DataProvider.Instance(Definition.NameSqlProvider).User_Update(_objUser);
        }
    }
}
